<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <p:dialog header="Creare dosar nou" dynamic="true" modal="true" widgetVar="create_folderWV" resizable="false"
              width="800">

        <h:form id="create_folder_form">
            <pe:tooltip global="true" myPosition="left center" atPosition="right center" for="@(.ui-state-error)"/>
            <h:panelGrid columns="4" columnClasses="column-1, column-200, column-1, column-200"
                         styleClass="form-elements">
                <p:outputLabel value="Nume:" for="last_name"/>
                <p:inputText id="last_name" value="#{folderAdministrationBean.selectedFolder.lastName}"
                             required="true" title="Numele este necesar."/>

                <p:outputLabel value="Prenume:" for="first_name"/>
                <p:inputText id="first_name" value="#{folderAdministrationBean.selectedFolder.firstName}"
                             required="true" title="Prenumele este necesar."/>

                <p:outputLabel value="Patronimic:" for="patronymic"/>
                <p:inputText id="patronymic" value="#{folderAdministrationBean.selectedFolder.patronymic}"
                             required="true" title="Patronimicul este necesar."/>

                <p:outputLabel value="Data nasterii:" for="birth_date"/>
                <p:calendar id="birth_date" value="#{folderAdministrationBean.selectedFolder.birthDate}"
                            required="true" title="Data nasterii este necesara."/>

                <p:outputLabel value="Codul IDNP:" for="idnp"/>
                <p:inputText id="idnp" value="#{folderAdministrationBean.selectedFolder.IDNP}" required="true"
                             title="Codul IDNP este necesar." maxlength="13"/>

                <p:outputLabel value="Domiciliul:" for="residence_visa"/>
                <p:inputText id="residence_visa" value="#{folderAdministrationBean.selectedFolder.residenceVisa}"
                             required="true" title="Domiciliul este necesar."/>

                <p:outputLabel value="Informatie de contact:" for="contact_info"/>
                <p:inputMask id="contact_info" value="#{folderAdministrationBean.selectedFolder.contactData}"
                             mask="+373 (999) 999 99?9" required="true" title="Informatia de contact este necesara."/>

                <p:outputLabel value="Nationalitatea:" for="nationality"/>
                <p:selectOneMenu id="nationality" value="#{folderAdministrationBean.selectedFolder.nationality}"
                                 required="true">
                    <f:selectItem itemLabel="Selectati nationalitatea"/>
                    <f:selectItems value="#{applicationStateBean.nationalities}" var="n" itemLabel="#{n.name}"
                                   itemValue="#{n.id}"/>
                </p:selectOneMenu>

                <p:outputLabel value="Sex:" for="sex"/>
                <p:selectOneRadio id="sex" value="#{folderAdministrationBean.selectedFolder.sex}" required="true">
                    <f:selectItem itemLabel="Masculin" itemValue="0"/>
                    <f:selectItem itemLabel="Femenin" itemValue="1"/>
                </p:selectOneRadio>

                <p:outputLabel value="Starea familiala:" for="family_status"/>
                <p:selectOneMenu id="family_status" value="#{folderAdministrationBean.selectedFolder.familyStatus}"
                                 required="true">
                    <f:selectItem itemLabel="Selectati starea familiala..."/>
                    <f:selectItems value="#{applicationStateBean.familyStatuses}" var="fs" itemLabel="#{fs.name}"
                                   itemValue="#{fs.id}"/>
                </p:selectOneMenu>

                <p:outputLabel value="Legitimatia:" for="card_id"/>
                <p:inputText id="card_id" value="#{folderAdministrationBean.selectedFolder.cardID}" maxlength="10"/>

                <p:outputLabel value="Stampila:" for="stamp"/>
                <p:inputText id="stamp" value="#{folderAdministrationBean.selectedFolder.stamp}"/>

                <p:outputLabel for="syndicate_member" value="Membru sindicat:"/>
                <p:selectBooleanCheckbox id="syndicate_member"
                                         value="#{folderAdministrationBean.selectedFolder.syndicateMember}"/>

            </h:panelGrid>

            <p:outputPanel layout="block" style="border-top: 1px solid #A8A8A8; padding: 5px;">
                <p:commandButton value="Salveaza" icon="ui-icon-disk" update="@form :folders_content:folders_list_form"
                                 actionListener="#{folderAdministrationBean.saveFolderData}"
                                 oncomplete="if (args &amp;&amp; !args.validationFailed) create_folderWV.hide()"/>
                <p:commandButton value="Anuleaza" process="@none" oncomplete="PF('create_folderWV').hide()"
                                 update="@form"
                                 actionListener="#{folderAdministrationBean.resetCreateFolderDialog}"
                                 resetValues="true"/>
            </p:outputPanel>
        </h:form>
    </p:dialog>
</ui:composition>